package com.ruoyi.system.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class SchedulingService {

    @Autowired
    private TaskScheduler taskScheduler;

    public void scheduleOneTimeTask(Runnable task, long delayMillis) {
        taskScheduler.schedule(task, new Date(System.currentTimeMillis() + delayMillis));
    }
}
